<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Dart : Libraries : box2d : World</title>
</head>

<body>

<header></header>

<h1 id="title">class <a name='World::World'>World</a></h1>

<section id="inheritance">

<section class="supertype">
<h2>Supertype:</h2>
<ul><li>Object</li></ul>
</section>

</section>

<section id="summary">

 The world class manages all physics entities, dynamic simulation,
 and asynchronous queries. The world also contains efficient memory
 management facilities.

 Author: Daniel Murphy
</section>

<section id="fields">
<h2>Fields</h2>
<dl>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::CLEAR_FORCES'>CLEAR_FORCES
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::LOCKED'>LOCKED
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::NEW_FIXTURE'>NEW_FIXTURE
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::WORLD_POOL_CONTAINER_SIZE'>WORLD_POOL_CONTAINER_SIZE
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::WORLD_POOL_SIZE'>WORLD_POOL_SIZE
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='bool.html#bool::bool'>bool</a></code></code></span>
<span class="field-name"><code><a name='World::autoClearForces'>autoClearForces
</a></code></span>
</dt>
<dd>

 Set flag to control automatic clearing of forces after each time step.
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='World::axis'>axis
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Sweep.html#Sweep::Sweep'>Sweep</a></code></code></span>
<span class="field-name"><code><a name='World::backup'>backup
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='World::cA'>cA
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='World::cB'>cB
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Vector.html#Vector::Vector'>Vector</a></code></code></span>
<span class="field-name"><code><a name='World::center'>center
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::contactCount'>contactCount
</a></code></span>
</dt>
<dd>

 Get the number of contacts (each may have 0 or more contact points).
</dd>
<dt>
<span class="field-type"><code><code><a href='ContactFilter.html#ContactFilter::ContactFilter'>ContactFilter</a></code></code></span>
<span class="field-name"><code><a name='World::contactFilter'>contactFilter
</a></code></span>
</dt>
<dd>

 Register a contact filter to provide specific control over collision.
 Otherwise the default filter is used (_defaultFilter). The listener is
 owned by you and must remain in scope.
</dd>
<dt>
<span class="field-type"><code><code><a href='Contact.html#Contact::Contact'>Contact</a></code></code></span>
<span class="field-name"><code><a name='World::contactList'>contactList
</a></code></span>
</dt>
<dd>

 Get the world contact list. With the returned contact, use Contact.getNext
 to get the next contact in the world list. A null contact indicates the
 end of the list.

 return the head of the world contact list.
 warning contacts are
</dd>
<dt>
<span class="field-type"><code><code><a href='ContactListener.html#ContactListener::ContactListener'>ContactListener</a></code></code></span>
<span class="field-name"><code><a name='World::contactListener'>contactListener
</a></code></span>
</dt>
<dd>

 Register a contact event listener. The listener is owned by you and must
 remain in scope.
</dd>
<dt>
<span class="field-type"><code><code><a href='List.html#List::List'>List&lt;E&gt;</a></code></code></span>
<span class="field-name"><code><a name='World::contacts'>contacts
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='DebugDraw.html#DebugDraw::DebugDraw'>DebugDraw</a></code></code></span>
<span class="field-name"><code><a name='World::debugDraw'>debugDraw
</a></code></span>
</dt>
<dd>

 Register a routine for debug drawing. The debug draw functions are called
 inside with World.DrawDebugData method. The debug draw object is owned
 by you and must remain in scope.
</dd>
<dt>
<span class="field-type"><code><code><a href='Island.html#Island::Island'>Island</a></code></code></span>
<span class="field-name"><code><a name='World::island'>island
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::jointCount'>jointCount
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='Joint.html#Joint::Joint'>Joint</a></code></code></span>
<span class="field-name"><code><a name='World::jointList'>jointList
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='bool.html#bool::bool'>bool</a></code></code></span>
<span class="field-name"><code><a name='World::locked'>locked
</a></code></span>
</dt>
<dd>

 Is the world locked (in the middle of a time step).
</dd>
<dt>
<span class="field-type"><code><code><a href='int.html#int::int'>int</a></code></code></span>
<span class="field-name"><code><a name='World::proxyCount'>proxyCount
</a></code></span>
</dt>
<dd>

 Get the number of broad-phase proxies.
</dd>
<dt>
<span class="field-type"><code><code><a href='List.html#List::List'>List&lt;E&gt;</a></code></code></span>
<span class="field-name"><code><a name='World::stack'>stack
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='TimeStep.html#TimeStep::TimeStep'>TimeStep</a></code></code></span>
<span class="field-name"><code><a name='World::timestep'>timestep
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='TimeOfImpactInput.html#TimeOfImpactInput::TimeOfImpactInput'>TimeOfImpactInput</a></code></code></span>
<span class="field-name"><code><a name='World::toiInput'>toiInput
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='TimeOfImpactOutput.html#TimeOfImpactOutput::TimeOfImpactOutput'>TimeOfImpactOutput</a></code></code></span>
<span class="field-name"><code><a name='World::toiOutput'>toiOutput
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='TimeOfImpactSolver.html#TimeOfImpactSolver::TimeOfImpactSolver'>TimeOfImpactSolver</a></code></code></span>
<span class="field-name"><code><a name='World::toiSolver'>toiSolver
</a></code></span>
</dt>
<dd>
</dd>
<dt>
<span class="field-type"><code><code><a href='WorldQueryWrapper.html#WorldQueryWrapper::WorldQueryWrapper'>WorldQueryWrapper</a></code></code></span>
<span class="field-name"><code><a name='World::wqwrapper'>wqwrapper
</a></code></span>
</dt>
<dd>
</dd>
</dl>
</section>

<section id="constructors">
<h2>Constructors</h2>
<dl>
<dt>
<code><a href='World.html#World::World'>World</a>(<code><a href='Vector.html#Vector::Vector'>Vector</a></code> <a name='World::::gravity'>gravity</a>, <code><a href='bool.html#bool::bool'>bool</a></code> <a name='World::::doSleep'>doSleep</a>, <code><a href='DefaultWorldPool.html#DefaultWorldPool::DefaultWorldPool'>DefaultWorldPool</a></code> <a name='World::::argPool'>argPool</a>)</code>
</dt>
<dd>

 Constructs a world object.

 gravity
   the world gravity vector.
 doSleep
   improve performance by not simulating inactive bodies.
</dd>
</dl>
</section>

<section id="methods">
<h2>Methods</h2>
<dl>
<dt>
<code>void <a name='World::clearForces'>clearForces</a>()</code></dt>
<dd>

 Call this after you are done with time steps to clear the forces.
 You normally call this after each call to Step, unless you are
 performing sub-steps. By default, forces will be automatically cleared,
 so you don't need to call this function.

 see setAutoClearForces
</dd>
<dt>
<code><code><a href='Body.html#Body::Body'>Body</a></code> <a name='World::createBody'>createBody</a>(<code><a href='BodyDef.html#BodyDef::BodyDef'>BodyDef</a></code> <a name='World::createBody::def'>def</a>)</code></dt>
<dd>

 Create a rigid body given a definition. No reference to the definition
 is retained.
</dd>
<dt>
<code><code><a href='Joint.html#Joint::Joint'>Joint</a></code> <a name='World::createJoint'>createJoint</a>(<code><a href='JointDef.html#JointDef::JointDef'>JointDef</a></code> <a name='World::createJoint::def'>def</a>)</code></dt>
<dd>

 Create a joint to constrain bodies together. No reference to the definition
 is retained. This may cause the connected bodies to cease colliding.

 Warning: This function is locked during callbacks.
</dd>
<dt>
<code>void <a name='World::destroyBody'>destroyBody</a>(<code><a href='Body.html#Body::Body'>Body</a></code> <a name='World::destroyBody::body'>body</a>)</code></dt>
<dd>

 Destroy a rigid body given a definition. No reference to the definition
 is retained. This function is locked during callbacks.

 warning: This automatically deletes all associated shapes.
 warning: This function is locked during callbacks.
</dd>
<dt>
<code>void <a name='World::destroyJoint'>destroyJoint</a>(<code><a href='Joint.html#Joint::Joint'>Joint</a></code> <a name='World::destroyJoint::joint'>joint</a>)</code></dt>
<dd>

 Destroy a joint. This may cause the connected bodies to begin colliding.

 Warning: This function is locked during callbacks.
</dd>
<dt>
<code>void <a name='World::drawDebugData'>drawDebugData</a>()</code></dt>
<dd>

 Call this to draw shapes and other debug draw data.
</dd>
<dt>
<code>void <a name='World::drawJoint'>drawJoint</a>(<code><a href='Joint.html#Joint::Joint'>Joint</a></code> <a name='World::drawJoint::joint'>joint</a>)</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::drawShape'>drawShape</a>(<code><a href='Fixture.html#Fixture::Fixture'>Fixture</a></code> <a name='World::drawShape::fixture'>fixture</a>, <code><a href='Transform.html#Transform::Transform'>Transform</a></code> <a name='World::drawShape::xf'>xf</a>, <code><a href='Color3.html#Color3::Color3'>Color3</a></code> <a name='World::drawShape::color'>color</a>)</code></dt>
<dd>
</dd>
<dt>
<code><code><a href='Contact.html#Contact::Contact'>Contact</a></code> <a name='World::popContact'>popContact</a>(<code><a href='Fixture.html#Fixture::Fixture'>Fixture</a></code> <a name='World::popContact::fixtureA'>fixtureA</a>, <code><a href='Fixture.html#Fixture::Fixture'>Fixture</a></code> <a name='World::popContact::fixtureB'>fixtureB</a>)</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::pushContact'>pushContact</a>(<code><a href='Contact.html#Contact::Contact'>Contact</a></code> <a name='World::pushContact::contact'>contact</a>)</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::queryAABB'>queryAABB</a>(<code><a href='QueryCallback.html#QueryCallback::QueryCallback'>QueryCallback</a></code> <a name='World::queryAABB::callback'>callback</a>, <code><a href='AxisAlignedBox.html#AxisAlignedBox::AxisAlignedBox'>AxisAlignedBox</a></code> <a name='World::queryAABB::aabb'>aabb</a>)</code></dt>
<dd>

 Query the world for all fixtures that potentially overlap the
 provided AABB.

 param callback
   a user implemented callback class.
 param aabb
   the query box.
</dd>
<dt>
<code>void <a name='World::solve'>solve</a>(<code><a href='TimeStep.html#TimeStep::TimeStep'>TimeStep</a></code> <a name='World::solve::timeStep'>timeStep</a>)</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::solveTimeOfImpact'>solveTimeOfImpact</a>()</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::solveTimeOfImpactGivenBody'>solveTimeOfImpactGivenBody</a>(<code><a href='Body.html#Body::Body'>Body</a></code> <a name='World::solveTimeOfImpactGivenBody::body'>body</a>)</code></dt>
<dd>
</dd>
<dt>
<code>void <a name='World::step'>step</a>(<code><a href='num.html#num::num'>num</a></code> <a name='World::step::dt'>dt</a>, <code><a href='int.html#int::int'>int</a></code> <a name='World::step::velocityIterations'>velocityIterations</a>, <code><a href='int.html#int::int'>int</a></code> <a name='World::step::positionIterations'>positionIterations</a>)</code></dt>
<dd>

 Take a time step. This performs collision detection, integration,
 and constraint solution.

 param timeStep
   the amount of time to simulate, this should not vary.
 param velocityIterations
   for the velocity constraint solver.
 param positionIterations
   for the position constraint solver.
</dd>
</dl>
</section>

<footer></footer>

</body></html>
